<?php require('./head.php');?>
<div style='max-width: 800px;margin: 5px auto;'><a href="./set.php">新建模板</a></div>
<div style='padding-bottom: 300px;'><?php
require('./db.php');
function func_response($str = '')
{
    echo $str;exit;
}
$sql = "SELECT * FROM `template` order by k";
$res = Database::query($sql);
if (empty($res)) {
    func_response("当前无模板");
}
foreach ($res as $item) {
    echo "<div style='max-width: 800px;margin: 5px auto;padding: 5px;border: 1px dashed red;'>";
    echo "<a name='".$item['k']."'></a>";
    echo "模板" . $item['k'];
    echo "<a style='float: right;' href='./set.php?template=".$item['k']."'>修改</a>";
    echo html_entity_decode($item['v']);
    echo "</div>";
}
?>
</div>
